package com.doit.day02;

import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;

import java.io.IOException;

public class _05_删除一张表 {
    public static void main(String[] args) throws IOException {
        Connection conn = HbaseUtil.getConn();
        Admin admin = conn.getAdmin();

        TableName tableName = TableName.valueOf("doit:table_name");


        admin.disableTable(tableName);

        boolean flag = admin.isTableDisabled(tableName);
        if (flag){
            System.out.println("表已经被禁用，可以删除");
            admin.deleteTable(tableName);
        }else {
            System.out.println("表是启用状态，不能被删除");
        }
        admin.close();
    }
}
